﻿using System.Collections.Generic;
using HouseKeeperCore.Elemental;

namespace HouseKeeperCore.Hierarchical
{
    /// <summary>
    ///  A class whose instance is an entity and can be tagged but not tagging
    /// </summary>
    public class TaggedEntity : Entity, ITagged
    {
        #region Properties

        #region Implementation of ITagged

        /// <summary>
        ///  Enumerates all tags that tag this entity
        /// </summary>
        public IEnumerable<ITagging> TaggingItems
        {
            get
            {
                foreach (var p in TaggingItemsLookup)
                {
                    yield return p.Value;
                }
            }
        }

        #endregion

        /// <summary>
        ///  A dictionary that holds all the owners of this group and keys them with their ID
        /// </summary>
        public IDictionary<long, ITagging> TaggingItemsLookup
        {
            get;
            internal set;
        }

        #endregion

        #region Constructors

        /// <summary>
        ///  Instantiates a tagged entity with specified ID
        /// </summary>
        /// <param name="id">The ID that uniquely identifies the tagged entity as an entity</param>
        public TaggedEntity(long id)
            : base(id)
        {
            TaggingItemsLookup = new Dictionary<long, ITagging>();
        }

        #endregion
    }
}
